/**
 * Description:
 * Class Name:EnumerationTest
 * Date:2022/3/14 17:31
 *
 * @author LTisme
 * @version JAVA17
 */
package 疯狂Java讲义.第8章_Java集合._8_9_烦琐的接口_Enumeration;

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;

public class EnumerationTest {
    public static void main(String[] args) {
        var v = new Vector<>();
        v.add("疯狂Java讲义");
        v.add("轻量级Java EE企业应用实战");
        var scores = new Hashtable<>();
        scores.put("语文", 78);
        scores.put("数学", 88);

        Enumeration em = v.elements();                  // 获取v中的所有value
        while (em.hasMoreElements()){
            System.out.println(em.nextElement());
        }
        Enumeration keyEm = scores.keys();              // 获取scores中的所有key
        while (keyEm.hasMoreElements()){
            System.out.println(keyEm.nextElement());
        }
    }
}
